package de.cau.apo.problems;

import de.cau.apo.exceptions.NotFeasibleException;

/**
 * The interface for the solutions of any optimization problems.
 * This interface defines the general methods that are needed to
 * communicate with the evaluation program.
 *  
 * @author Marius Richter
 *
 * @param <I> the instance type with that this solution type shall interact
 */
public interface ISolution<I extends IInstance> {

	/**
	 * Decode the information in solution by informations of the corresponding instance and stores the result in 
	 * this solution object.
	 * @param solution a solution string created by the decode method of this class
	 */
	public void decode(String solution);
	
	/**
	 * Encode the solution into a string.
	 * @return the encoded solution string
	 */
	public String encode();
	
	/**
	 * @return the objective value of this solution by informations of the corresponding instance
	 */
	public double getObjValue();
	
	/**
	 * 
	 * @throws NotFeasibleException if this solution doesn't fulfill all the conditions of the corresponding instance
	 */
	public void isFeasible() throws NotFeasibleException;
	
}
